package net.elive.common.p2pnet;

import java.net.DatagramPacket;
import java.net.InetAddress;

import net.elive.tools.Contants;

public abstract class AbstractMessage implements IMassage {
	/**
	 * 版本号
	 */
	protected short version =0;
	/**
	 * 消息类型
	 */
	protected short sType =0;
	/**
	 * 封装数据包
	 */
	protected DatagramPacket dp;//封装的数据包
	@Override
	public short getVersion() {
		return version;
	}
	/**
	 * 获取消息类型
	 */
	@Override
	public short getSType() {
		return sType;
	}
	/**
	 * 获取封装好的数据包
	 */
	@Override
	public DatagramPacket getDatagramPacket() {
		return dp;
	}
	/**
	 * 设置目标IP地址
	 * @param destnationIp
	 */
	public void setDestnationAddress(InetAddress destnationIp){
		dp.setAddress(destnationIp);
	}
	/**
	 * 设置目标IP地址端口
	 * @param destnationPort
	 */
	public void setDestnationPort(int destnationPort){
		dp.setPort(destnationPort);
	}

}
